import {createRouter, createWebHistory} from "vue-router"

const routes = [

    {
        path: '/',
        name: 'home',
        redirect: '/main'
    },
    {
        path: '/main',
        name: 'main',
        redirect: '/index',
        component :() => import('../layout/index.vue'),
        children:[
            {
                path: '/index',
                name: 'index',
                redirect: '/index/interest',
                component :() => import('../pages/frontend/index.vue'),
                meta: {
                    title: 'WeBlog首页'
                },
                children: [
                    {
                        path: '/index/interest', //关注
                        name: 'interest',
                        component: () => import('../pages/frontend/interest/index.vue')
                    },
                    {
                        path: '/index/recommend', //推荐
                        name: 'recommend',
                        component: () => import('../pages/frontend/recommend/index.vue')
                    },
                    {
                        path: '/index/hotlist', //热榜
                        name: 'hotlist',
                        component: () => import('../pages/frontend/hotlist/index.vue')
                    },
                    {
                        path: '/index/video', //视频
                        name: 'video',
                        component: () => import('../pages/frontend/video/index.vue')
                    },
                ]
            },
            {
                path: '/share',
                name: 'share',
                component: () => import('../pages/share/index.vue'),
            }, 
            {
                path: '/question',
                name: 'question',
                component: () => import('../pages/question/index.vue')
            },
            {
                path: '/note',
                name: 'note',
                component: () => import('../pages/note/index.vue')
            },
            {
                path: '/details',
                name: 'details',
                component: () => import('../pages/details/index.vue')
            }

        ]
    },
    {
        path: '/about',
        name: 'about',
        component: () => import('../pages/about.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('../pages/login/index.vue')
    }

]

const router = createRouter({
    history: createWebHistory("/"),
    routes
})

export default router